package com.jerry.base.java8.closure;

/**
 * 闭包2
 *
 * @author Jerry
 * @since 2024/7/31 21:17
 */
public class ClosureTest2 {

    static int a = 1;
    int b = 2;

    @FunctionalInterface
    interface Lambda {
        int operate(int y);
    }

    static void highOrder(ClosureTest1.Lambda lambda) {
        System.out.println(lambda.operate(1));
    }

    public static void main(String[] args) {
        ClosureTest2 test = new ClosureTest2();
        test.test(18);
    }

    public void test(int c) {
        highOrder(y -> a + y);
        highOrder(y -> b + y);
        highOrder(y -> c + y);
    }

}
